package com.maple.exclusivesport;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;

/**
 * Created by Kuson on 17/5/21.
 */

public abstract class BaseDialog extends Dialog {

    public BaseDialog(@NonNull Context context) {
        super(context, R.style.MyDialog);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        FrameLayout layout = (FrameLayout)getLayoutInflater().inflate(R.layout.dialog_layout, null);
        setCanceledOnTouchOutside(false);
        View view = contentView(layout);
        layout.addView(view);
        setContentView(layout);

    }

    /**
     * Dialog视图,由子类实现并返回
     * @return
     */
    protected abstract View contentView(ViewGroup parent);
}
